package metamodel;

import java.util.HashMap;

public class MyClass {

	private String name;
	
	private String type;
	
	private String packageName;
	
	private HashMap<String, Method> methods;
	
	private HashMap<String, Attribute> attributes;

	public MyClass(String packageName, String name) {
		this.name = name;
		this.packageName = packageName;
		this.type = name;
		this.methods = new HashMap<String, Method>();
		this.attributes = new HashMap<String, Attribute>();
	}

	@SuppressWarnings("unchecked")
	public MyClass(String name, MyClass klass) {
		this.name = name;
		this.packageName = klass.getPackageName();
		this.type = klass.getType();
		this.methods = (HashMap<String, Method>) klass.getMethods().clone();
		this.attributes = (HashMap<String, Attribute>) klass.getAttributes().clone();
	}

	public HashMap<String, Attribute> getAttributes() {
		return this.attributes;
	}

	public String getType() {
		return this.type;
	}

	public HashMap<String, Method> getMethods() {
		return this.methods;
	}

	public String getName() {
		return this.name;
	}

	public void addAttribute(Attribute attribute) {
		this.attributes.put(attribute.getName(), attribute);
	}

	public void addMethod(Method method) {
		this.methods.put(method.getName(), method);
	}

	public Method getMethod(String methodName) {
		return this.methods.get(methodName);
	}
	
	public Attribute getAttribute(String attributeName) {
		return this.attributes.get(attributeName);
	}

	public String getPackageName() {
		return this.packageName;
	}

}
;